Querying video data with reduced latency and cost

ABSTRACT

A method can include classifying, using a compressed and specialized convolutional neural network (CNN), an object of a video frame into classes, clustering the object based on a distance of a feature vector of the object to a feature vector of a centroid object of the cluster, storing top-k classes, a centroid identification, and a cluster identification, in response to receiving a query for objects of class X from a specific video stream, retrieving image data for each centroid of each cluster that includes the class X as one of the top-k classes, classifying, using a ground truth CNN (GT-CNN), the retrieved image data for each centroid, and for each centroid determined to be classified as a member of the class X providing image data for each object in each cluster associated with the centroid.

PRIORITY CLAIM

This application claims priority to U.S. Provisional Patent ApplicationNo. 62/611,297, filed on Dec. 28, 2017, and titled “QUERYING VIDEO DATAWITH REDUCED LATENCY AND COST,” the disclosure of which is incorporatedherein by reference in its entirety.

BACKGROUND

Cameras are ubiquitous, with millions of them deployed by government andprivate entities at traffic intersections, enterprise offices, andretail stores. Video from at least some of these cameras arecontinuously recorded. One of the main purposes for recording the videosis answering “after-the-fact” queries. An after-the-fact query caninclude identifying video frames with objects of certain classes (e.g.,cars or bags) over many days of recorded video. As results from thesequeries are used by analysts and investigators, achieving low querylatencies, while maintaining query accuracy, can be advantageous.

Advances in convolutional neural networks (CNNs), backed by copioustraining data and hardware accelerators (e.g., GPUs), have led to highaccuracy in the computer vision tasks like object detection and objectclassification. For example, the ResNet152 object classifier CNN won theImageNet challenge that evaluates classification accuracy on 1,000classes using a public image dataset with labeled ground truths. Foreach image, these classifiers return a ranked list of 1,000 classes indecreasing order of confidence.

Despite the accuracy of conventional image classifier CNNs (likeResNet152), using them for video analytics queries is both expensive andslow. Using the ResNet152 classifier at query-time to identify videoframes with cars on a month-long traffic video includes 280 GPU hoursand cost a significant amount of money to use the correspondingcomputing cloud. The latency for running queries is also high. Toachieve a query latency of one minute on 280 GPU hours of work wouldinvolve tens of thousands of GPUs classifying the frames of the video inparallel, which is many orders of magnitude more than what is typicallyprovided (few tens or hundreds) by traffic jurisdictions or retailstores.

SUMMARY

This summary section is provided to introduce aspects of embodiments ina simplified form, with further explanation of the embodiments followingin the detailed description. This summary section is not intended toidentify essential or required features of the claimed subject matter,and the combination and order of elements listed in this summary sectionare not intended to provide limitation to the elements of the claimedsubject matter.

At least one machine-readable storage medium can include instructionsfor execution by processing circuitry to perform operations comprisingclassifying, using a compressed and specialized convolutional neuralnetwork (CNN) implemented by the processing circuitry, an object of avideo frame into classes, clustering the object based on a distance of afeature vector of the object to a feature vector of a centroid object ofthe cluster, storing, for each object, image data, top-k classes of theclasses, a centroid identification indicating a centroid of the cluster,and a cluster identification indicating the cluster associated with thecentroid, for each centroid determined to be classified as a member ofthe class X, by a ground truth CNN (GT-CNN) implemented by theprocessing circuitry, providing image data for each object in eachcluster associated with the centroid.

A method, performed by at least one processor of a computing system, caninclude classifying, using a compressed and specialized convolutionalneural network (CNN), an object of a video frame into classes,clustering the object based on a distance of a feature vector of theobject to a feature vector of a centroid object of the cluster, storing,for each object, image data, top-k classes of the classes, a centroididentification indicating a centroid of the cluster, and a clusteridentification indicating the cluster associated with the centroid, inresponse to receiving a query for objects of class X from a specificvideo stream, retrieving image data for each centroid of each clusterthat includes the class X as a member of the stored top-k classes,classifying, using a ground truth CNN (GT-CNN), the retrieved image datafor each centroid, and for each centroid determined to be classified asa member of the class X, by the GT-CNN, providing image data for eachobject in each cluster associated with the centroid.

A system can include circuitry to implement a plurality of compressedand specialized convolutional neural networks (CNNs) trained to classifyan object of a video frame into classes and a ground truth CNN (GT-CNN)trained to classify image data of a centroid of a cluster of clusters ofobjects, a processor, and a memory device coupled to the processor, thememory device including a program stored thereon for execution by theprocessor to perform operations, the operations comprising clusteringthe object based on a distance of a feature vector of the object to afeature vector of a centroid object of the cluster, storing, in thememory and for each object, a frame identification indicating one ormore frames in which the object is present, top-k classes of theclasses, a centroid identification indicating a centroid of the cluster,and a cluster identification indicating the cluster associated with thecentroid, and for each centroid determined to be classified as a memberof a class X of the classes, by the ground truth CNN (GT-CNN), providingthe one or more frames associated with the frame identification for eachobject in each cluster associated with the centroid.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates, by way of example, a diagram of embodiments of aCNN.

FIG. 2 illustrates, by way of example, a diagram of a cumulativedistribution function (CDF) of a frequency of object classes in somevideos (as classified by ResNet152).

FIG. 3 illustrates, by way of example, a diagram of an embodiment of asystem.

FIG. 4 illustrates, by way of example, a bar graph detailing an effectof k on recall on one of the video streams.

FIG. 5 illustrates, by way of example, a graph of parameter selectionbased on the ingest cost and query latency for one of the video streams.

FIG. 6 illustrates by way of example, a bar graph of a general summaryof evaluation results.

FIG. 7 illustrates, by way of example, the breakdown of ingest-time costand query latency across different design points.

FIG. 8 illustrates, by way of example, a graph that illustrates the (I,Q) values for both opt-ingest (Opt-I) and opt-query (Opt-Q) for therepresentative videos.

FIGS. 9 and 10 illustrate, by way of example, bar graphs of theimprovements of ingest cost and query latency of embodiments compared tothe baselines under different accuracy targets.

FIGS. 11 and 12, illustrate, by way of example the ingest cost and querylatency of embodiments at different frame rates e.g., 30 fps, 10 fps, 5fps, and 1 fps) compared to ingest-all and query-all, respectively.

FIG. 13 illustrates, by way of example, a diagram of an embodiment of amethod for video ingest, index, and/or query fulfillment.

FIG. 14 illustrates, by way of example, a block diagram of an embodimentof a machine (e.g., a computer system) to implement one or moreembodiments.

DETAILED DESCRIPTION

In the following description, reference is made to the accompanyingdrawings that form a part hereof, and in which is shown by way ofillustration specific embodiments which may be practiced. Theseembodiments are described in sufficient detail to enable those skilledin the art to practice the embodiments. It is to be understood thatother embodiments may be utilized and that structural, logical, and/orelectrical changes may be made without departing from the scope of theembodiments. The following description of embodiments is, therefore, notto be taken in a limited sense, and the scope of the embodiments isdefined by the appended claims.

The operations, functions, or algorithms described herein may beimplemented in software in some embodiments. The software may includecomputer executable instructions stored on computer or othermachine-readable media or storage device, such as one or morenon-transitory memories (e.g., a non-transitory machine-readable medium)or other type of hardware based storage devices, either local ornetworked. Further, such functions may correspond to subsystems, whichmay be software, hardware, firmware or a combination thereof. Multiplefunctions may be performed in one or more subsystems as desired, and theembodiments described are merely examples. The software may be executedon a digital signal processor, ASIC, microprocessor, central processingunit (CPU), graphics processing unit (GPU), field programmable gatearray (FPGA), or other type of processor operating on a computer system,such as a personal computer, server or other computer system, turningsuch computer system into a specifically programmed machine. Thefunctions or algorithms may be implemented using processing circuitry,such as may include electric and/or electronic components (e.g., one ormore transistors, resistors, capacitors, inductors, amplifiers,modulators, demodulators, antennas, radios, regulators, diodes,oscillators, multiplexers, logic gates, buffers, caches, memories, GPUs,CPUs, field programmable gate arrays (FPGAs), or the like).

Discussed herein are embodiments that may include querying videodatasets (or other large datasets) at reduced cost and latency. Reducedlatency is an amount of time it takes to perform the query. Reduced costis actual dollar cost and/or compute resource cost. Embodiments canreduce a number of compute resources required to perform the query.Embodiments can return results of a query in less time than previoussolutions to querying such data.

As previously discussed, large volumes of videos are continuouslyrecorded from cameras deployed for traffic control and surveillance withthe goal of answering “after the fact” queries, such as identifyingvideo frames with objects of certain classes (e.g., cars, bags, amongmany others) from many days of recorded video. While advancements inconvolutional neural networks (CNNs) have enabled answering such querieswith high accuracy, CNNs are too expensive and slow. Embodiments hereininclude a system for low-latency and low-cost querying on large videodatasets. Embodiments can use inexpensive ingestion techniques to indexvideos by the objects occurring in them. At ingest-time, embodiments canuse compression and video-specific specialization of CNNs. A loweraccuracy of the less expensive CNNs can be handled by judiciouslyleveraging expensive CNNs at query-time. To reduce query-time latency,similar objects can be clustered to help avoid redundant processing.Using experiments on video streams from traffic, surveillance and newschannels, embodiments use about 58 times fewer GPU cycles than runningexpensive ingest processors and are about 37 times faster thanprocessing all the video at query time.

Enabling low-latency and low-cost querying over large video datasets canmake video analytics more useful and open many new opportunities invideo analytics and processing. An approach to enabling low-latencyquerying is performing all classifications with ResNet152 atingest-time, for instance, on the live videos, and store the results inan index of object classes to video frames. Any queries for specificclasses (e.g., cars) will thus involve only a simple index lookup atquery-time. There are, however, at least two problems with thisapproach. First, the cost to index all the video at ingest-time, (e.g.,$250/month/stream) is prohibitively high. Second, most of thisingest-time cost is wasteful because typically only a small fraction ofrecorded videos gets queried. For example, following a theft, policemight query a few days of video from a few surveillance cameras, but notall the videos.

Embodiments include a system to support low-latency, low-cost queryingon large video datasets. To address one or more of the above drawbacks,one or more embodiments can satisfy one or more of the following goals:(1) low cost indexing of video at ingest-time, (2) high accuracy and lowlatency for queries, and (3) allowing trade-offs between the cost atingest-time against the latency at query-time. As input to one or moreembodiments, a user can specify the ground-truth CNN (or “GT-CNN” (e.g.,the ResNet152 classifier)) and the desired accuracy of results that areto be achieved relative to the GT-CNN.

Embodiments can use one or more of at least the following fourtechniques: (1) inexpensive CNNs for ingest, (2) using top-K resultsfrom the ingest-time CNN, (3) clustering similar objects, and (4)judicious selection of system and model parameters.

First, to make video ingestion inexpensive, embodiments can usecompressed and specialized versions of CNNs, to create an ingest-timeindex of object classes to frames. CNN compression creates new CNNs withfewer convolutional layers and smaller input images. Specializationtrains those CNNs on a smaller set of object classes specific to eachvideo stream. Together, these techniques result in more efficient CNNsfor video indexing.

Second, the inexpensive ingest CNNs, however, are also less accuratethan the expensive GT-CNN (like ResNet152), measured in terms of recalland precision. Recall is the fraction of frames in the video thatcontained objects of the queried class that were returned in the query'sresults. Precision, on the other hand, is the fraction of frames in thequery's results that contain objects of the queried class. To increaserecall, embodiments can rely on an empirical observation, namely, whilethe top-most (e.g., most confident) classification results of theinexpensive and expensive CNNs may not always match, the top-most resultof the expensive CNN falls within the top-K results of the inexpensiveCNN. Therefore, at ingest-time, embodiments index each object with thetop-K results of the inexpensive CNN (instead of just the top-most). Toincrease precision, at query-time, objects are filtered from the top-Kindex and then the filtered objects are classified with an expensiveGT-CNN.

Third, to reduce the query-time latency of using the expensive GT-CNN,embodiments can rely on a significant similarity between objects invideos. For example, a car moving across an intersection will look verysimilar in consecutive frames. Embodiments can leverage this similarityby clustering the objects at ingest-time, classifying only the clustercentroids with the expensive GT-CNN at query-time, and assigning thesame class to all objects in the cluster, thus considerably reducingquery latency.

In summary, embodiments at ingest-time and query-time can include one ormore operations as follows. At ingest-time, embodiments classify thedetected objects using a inexpensive CNN, cluster similar objects, andindex each cluster centroid using the top-K classification results. Atquery-time, when the user queries for class X, embodiments look up theingest index for centroids that match class X and classify them usingthe GT-CNN. For centroids that were classified as class X, it returnsall objects from the corresponding clusters to the user.

Embodiments can allow a user to choose an ingest-time CNN andcorresponding parameters to meet user-specified targets on precision andrecall. Among the choices that meet the accuracy targets, embodimentsallow the user to trade-off between the ingest cost and query latency.For example, selecting a relatively more inexpensive ingest CNN reducesthe ingest cost but increases the query latency. Embodiments canidentify the “sweet spot” in parameters that sharply improve one ofingest cost or query latency for a slight increase in the other.

Using the following techniques, various examples were built andevaluated using thirteen 12-hour videos from three domains—(1) trafficcameras, (2) surveillance cameras, and (3) news channels. A comparisonwas made against two baselines: “Ingest-all” that runs GT-CNN on allvideo frames during ingest, and “Query-all” that runs GT-CNN on all thevideo frames at query time, ResNet152 was used as GT-CNN and augmentedwith motion detection to remove frames with no objects. On average,embodiments are 58 times (up to 98 times) more inexpensive thaningest-all and 37 times (up to 57 times) faster than Query-all. Thisleads to the cost of ingestion coming down from about, for example,$250/month/stream to about $4/month/stream, and the latency to query a24-hour video from 1 hour to under 2 minutes. Additional results fromthese techniques are discussed with reference to the figures below.

The following discussion proceeds as follows: 1. A formulation of theproblem of querying video datasets by showing the trade-offs betweenquery latency, ingest cost, and accuracy (precision and recall) ofresults; 2. Techniques for inexpensive ingestion of videos usingcompression and video-specific specialization of CNNs, while stillmeeting the accuracy targets; and 3. Similarities between objects areidentified in a video end clustered using CNN features and significantlyspeeding up queries.

FIG. 1 illustrates, by way of example, a diagram of a CNN 100. The CNN100 represents a specific class of neural networks that work byextracting visual features in images 102. During image classification,or “inference”, the CNN 100 takes the input image 102 and outputs theprobability of each class 104 (e.g., dog, flower, car, or otherdetectable object). CNNs can be used for many computer vision tasks,such as image classification and face recognition.

Broadly, CNNs consist of three types of network layers: (1)convolutional and rectification layers 106, which detect visual featuresfrom input pixels, (2) pooling layers 108, which down-sample the inputby merging neighboring pixel values, and (3) one or more fully-connectedlayers 110, which provide the reasoning to classify the input objectbased on the outputs from previous layers. The outputs of an imageclassification CNN are the probabilities of all object classes 104. Theclass with the highest probability is the predicted class for the inputimage 102.

The output of the penultimate (i.e., previous-to-last) layer can beconsidered as “representative features” (e.g., extracted features 112)of the input image 102. The features are a real-valued vector, withlengths typically between 512 and 4096 in classifier CNNs. It has beenshown that images with similar feature vectors (e.g., feature vectorswith small Euclidean distances therebetween) are visually similar.

The high accuracy of CNNs comes at a cost. Inferring (or classifying)using CNNs to classify objects in images requires significantcomputational resources. This is because the higher accuracy of CNNscomes from using deeper architectures (e.g., more neural network layers)to obtain better visual features. For example, ResNet152, the winner ofthe ImageNet competition in 2015, has been trained to classify across1000 classes from the ImageNet dataset using 152 layers, but can onlyprocess 77 images/second even with a high-end GPU (NVIDIA K80). Thismakes querying on large video datasets using these CNNs slow and costly.

There are at least two recent techniques designed to reduce the cost ofCNNs. First, compression is a set of techniques aiming to reduce thecost of CNN inference (classification) at the expense of reducedaccuracy. Such techniques include removing some more expensiveconvolutional layers, matrix pruning, and others, and can reduce theclassification cost of a CNN. For example, ResNet18, which is aResNet152 variant with only 18 layers is 8 times more inexpensive thanResNet152. A more recent technique is called CNN specialization, wherethe CNNs are trained on a subset of a dataset specific to a particularcontext, making them more inexpensive. Using the combination ofinexpensive and expensive CNNs can be a part of embodiments.

Embodiments can support queries of the form, “find all frames in Y videothat contain objects of class X”, or similar form. Some characteristicsof real-world videos towards supporting these queries can include: (1)substantial portions of videos can be excluded, (2) only a limited setof object classes occur in each video, and (3) objects of the same classhave similar feature vectors. The design of some embodiments can bebased on one or more of these characteristics.

About 12 hours of video from six different video streams have beenanalyzed based on the presently disclosed techniques. The six videostreams span across traffic cameras, surveillance cameras, and newschannels. Objects are detected in each frame of these videos (e.g.,using background subtraction, but other techniques of object detectioncan be used). Each object was classified with a GT-CNN (e.g., ResNet152CNN) for all the object classes supported by the GT-CNN (e.g., ResNet152supports 1,000 object classes). In the discussion herein, results fromthe costly ResNet152 CNN are used as ground truth.

Excluding Portions of Video

There is considerable potential for avoidance of processing portions ofvideos at query-time. Portions of video streams either have no objectsat all (as in a garage camera at night) or the objects are stationary(like parked cars). In the video sets analyzed, one-third to one-half ofthe frames fall into one of these categories. Therefore, queries to anyobject class can benefit from pre-processing filters applied to excludethese portions of the videos.

Even among the frames that do contain objects, not all the frames arerelevant to a query because each query only looks for a specific classof objects. In some video sets, an object class occurs, on average, inonly 0.01% of the frames, and even the most frequent object classesoccur in no more than 16%-43% of the frames in the different videos.This is, at least in part, because while there are usually some dominantclasses (e.g., cars in a traffic camera, people in a news channel), mostother classes are rare. Since queries are for specific object classes,there is considerable potential in indexing frames by the classes ofobjects.

Limited Set of Object Classes in Each Video

There can be a disparity in the frequency at which classes of objectsoccur in each of the videos. Most video streams have a limited set ofobjects because each video has its own context (e.g., traffic camerascan have automobiles, pedestrians or bikes, but rarely airplanes). It israre that a video stream contains objects of all the classes recognizedby classifier CNNs.

FIG. 2 illustrates, by way of example, a diagram of a cumulativedistribution function (CDF) of a frequency of object classes in somevideos (as classified by ResNet152). Objects of only 22%-33% (notgraphed) of the 1,000 object classes occur in the less busy videos(Auburn, Jackson Hole, Lausanne, and Sittard, explained in more detailin Table 1). Even in the busier videos (CNN, and MSNBC, explained inmore detail in Table 1), objects of only 50%-69% of the classes appear.Also, there is little overlap between the classes of objects among thedifferent videos. On average, the Jaccard indexes (e.g., intersectionover union) between the videos based on their object classes is only0:46. Even among the object classes that do occur, a small fraction ofclasses disproportionately dominates. According to FIG. 2, about 3%-10%of the most frequent object classes cover about 95% or more of theobjects in each video stream. This suggests that for each video stream(i) a video's most frequently occurring classes can be determined and(ii) efficient CNNs specialized for classifying these classes can betrained.

Feature Vectors for Finding Duplicate Objects

Objects moving in video often stay in a frame for several seconds. Forexample, a pedestrian might take a minute to cross a street. Instead ofclassifying each instance of the same object across the frames,embodiments can classify only a single instance of duplicate objectsusing a CNN and apply a same label to all duplicates. Thus, given nduplicate objects, this technique can use only one CNN classificationoperation instead of n.

Comparing pixel values across frames is one technique to identifyduplicate objects. However, pixel value comparison is highly sensitiveto even slight changes in a camera's real-time view of an object.Instead, feature vectors extracted from the CNNs can be more robust thanpixel value comparison, since the feature vectors are trained to extractvisual features for classification. Robustness of feature vectorcomparison is provided in a following analysis. In each video, for eachobject, i, embodiments find its nearest neighbor, j, using featurevectors from an inexpensive CNN (e.g., ResNet 18) and compute a fractionof object pairs that belong to a same class. This fraction is over 99%in each of the videos, which demonstrates that feature vectors frominexpensive CNNs can be used to potentially help identify duplicateobjects.

Overview of Embodiments

Embodiments can index live video streams by the object classes ofobjects occurring in the video streams and enable answering“after-the-fact” queries on the stored videos of the form “find allframes that contain objects of class X”. Optionally, the query can berestricted to a subset of cameras and a time range. Such a queryformulation can form the basis for many widespread applications and canbe used either on its own (such as for detecting all cars or bicycles inthe video) or used as a basis for further processing (e.g., finding allcollisions between cars and bicycles).

Embodiments can be designed to work with a wide variety of current andfuture CNNs. At system configuration time, a user (e.g., systemadministrator) provides a ground-truth CNN (e.g., GT-CNN), which canserve as an accuracy baseline for embodiments. GT-CNNs, however, are fartoo costly to run on every video frame.

Through a sequence of techniques, embodiments provide nearly comparableaccuracy but at greatly reduced cost. By default, and throughout thisdiscussion, the ResNet152 image classifier is used as the GT-CNN.Because the acceptable target accuracy is application-dependent,embodiments permit the user to specify the target, while providingdefaults. Accuracy is specified in terms of precision (e.g., fraction offrames output by the query that contain an object of class X accordingto the GT-CNN), and recall, (e.g., fraction of frames that containobjects of class X according to GT-CNN that were actually returned bythe query). The lower the target, the greater the cost-savings providedby embodiments. Even for high targets, such as 95%-99%, embodiments canachieve an order-of-magnitude or more cost savings.

FIG. 3 illustrates, by way of example, a diagram of an embodiment of asystem 300. The system 300 as illustrated includes a camera 302, videoframes 304 from the camera 302, objects 306 extracted from the videoframes 304, specialized and/or compressed CNN 310, object featurevectors 312, object clusters 314, object top-k classes 316, top-k index318, a query 320, centroid objects 322, GT-CNN 324, matching cluster forclass X 326, and frames with one or more objects of class X 328. Thecomponents and operations to the left of the dashed line, operate foringest time, while components and operations to the right of the dashedline, operate for query time. Note that the top-K index 318 is generatedat ingest time and used at query time.

The camera 302 can include any device capable of capturing pixel data ofthe video frames 304. The video frames 304 include pixel datacorresponding to one or more objects in a field of view of the camera302. The objects 306 can be extracted from the video frames 304, such asby using background subtraction or other object extraction technique.The objects 306 include pixel values of sections of a video frame 304that are determined to include the object 306.

The CNN specialization 308 can be performed offline or online. The CNNspecialization 308 can include reducing a number of layers of a GT-CNN.The CNN specialization 308 can train the reduced CNN based on objectsknown to be in the video frame 304 from the camera 302. Specializationof a CNN can determine the weights for the specialized and/or compressedCNN. Specialization trains the CNN to detect only a subset of allclasses of objects that can be classified by the GT-CNN 324.

The specialized compressed CNN 310 can produce, as output from apenultimate layer, object feature vectors 312. The specializedcompressed CNN 310 produces, as output from the last layer of the CNN,object top-K classes. The object feature vector 312 is a dimensionaldata vector that represents features of an object.

The object top-K classes 316 include K of the highest probabilities andcorresponding classes associated with the highest probabilities. Theobject clusters 314 are determined based on the object feature vectors312. The object clusters 314 includes objects with feature vectors thatare within a specified distance e.g., L1 norm, L2 norm, or the othermeasure of data distance) from one another.

The object clusters 314, frames in which objects in each of the objectclusters 314 appear, the object top-k classes 316 to which thespecialized/compressed CNN 310 determined the objects belongs, and imagedata of the centroid object 322 of each of the object clusters 314 canbe stored in the top-k index 318. The top-k index 318 can be stored in amemory that is local or remote to the specialized and/or compressed CNN310 and the GT-CNN 324.

The query for class X 320 can include a command to return all frames ofobjects that are determined to be in class X. A computer processor orother compute device, can perform operations to determine, in responseto the query for class X 320, which clusters in the top-k index 318 weredetermined to include the class X in the object top-k classes 316. Theimage data for each centroid object 322, for each of the object clusters314, can be operated on by the GT-CNN 324. The top class, as output bythe last layer of the GT-CNN 324 can be used as the actual class of theobjects in the object clusters 314. The matching clusters for class X326 can be determined using the output of the GT-CNN 324 for each of thecentroid objects 322. The frames with objects of class X 328 can bedetermined using the top-k index 318 and returned as a result of thequery for class X 320.

At ingest-time (left of dashed line), embodiments can classify theobjects 306 in the incoming video frames 304 and extract their featurevectors 312, using a specialized and/or compressed CNN 310. To makeextracting the object feature vectors 312 and object top-k classesconsume less time or fewer compute resources, embodiments can use acompressed or specialized CNN 310 (e.g., a compressed or specializedversion of the GT-CNN 324). Embodiments can cluster objects 314 based ontheir feature vectors 312 and assign to each cluster the top-k mostlikely classes 316 these objects belong to (based on classificationconfidence of the ingest CNN 310). Embodiments create the top-k index318, which maps each class to the set of object clusters 314 if thecorresponding object cluster 314 includes the class in the object top-kclasses 316. The top-k index 318 can be the output of ingest-timeprocessing of videos of embodiments.

At query-time (right of the dashed line), in response to a user queryingfor a certain class X, embodiments retrieve the object clusters 314 fromthe top-k index 318 that include the class X in the object top-k classes316 associated therewith. The GT-CNN 324 runs the image data (e.g.,feature vector 312) of object centroids 322 of the object clusters 314that include the class X in the object top-k classes 316 through theGT-CNN 324. The GT-CNN 324 returns a class for each of the centroidobjects 322. The object clusters 314 that are determined to be class X(based on the determination that the corresponding centroid object 322is a member of class X) are identified. All frames of the objectclusters 314 whose respective centroid objects 322 were classified bythe GT-CNN 324 as class X can be returned as a response to the query forclass X 320.

The top-k ingest index 318 is a mapping between the object top-k classes316 to the object clusters 314. For example, object class →<cluster ID>and <cluster ID>→[centroid object, <objects> in cluster, <frame IDs> ofobjects in cluster].

Embodiments can keep ingest cost and query latency low while alsomeeting a user-specified accuracy targets. This is at least in partbecause of one or more of the following:

(1) an inexpensive ingest-time CNN (e.g., the compressed and/orspecialized CNN 310). Embodiments make indexing at ingest-time moreinexpensive by compressing and/or specializing the GT-CNN model for eachvideo stream. (i) Compression of CNN models uses fewer convolutionallayers and other approximation techniques. (ii) Specialization of CNNsuses the observation that specific video streams contain only a smallnumber of object classes and their appearance is more constrained thanin a generic video. Both techniques are done automatically and togetherresult in ingest-time CNN models that are up to 98 times moreinexpensive than a GT-CNN.

(2) The top-k ingest index 318 provides some improvements. Theinexpensive ingest-time CNNs are less accurate (e.g., their top-mostresults do not often match the top-most classifications of GT-CNN).Therefore, to keep the recall high, embodiments associate each objectwith the top-k classification results of the specialized and/orcompressed CNN 310, instead of just its top-most classification result.Increasing the value of k increases recall because the top-most resultsof the GT-CNN 324 often fall within the ingest-time CNN's top-k results.At query time, embodiments can use the GT-CNN 324 to remove objects inthis larger set that do not match the class X, to regain precision lostby including all the top-k classes.

(3) Clustering similar objects can provide some improvements. A highvalue of k at ingest-time increases the work to do at query time,thereby increasing query latency. To reduce this overhead, embodimentscluster similar objects at ingest-time using feature vectors from thespecialized and/or compressed CNN. In each cluster, at query-time, onlythe cluster centroids are run through the GT-CNN 324. The class Xdetermined to be the most probable class by the GT-CNN 324 can be usedas the class for all objects in the object cluster 314 to which thecentroid 322 is associated. Thus, if the objects are not tightlyclustered, clustering can reduce precision and recall.

(4) Embodiments can provide flexibility to trade off ingest-time vs.query-time costs. Embodiments automatically choose the specializedand/or compressed CNN 310, k, and specialization and clusteringparameters to achieve the desired precision and recall targets. Thesechoices also help embodiments perform a trade-off between the work doneat ingest-time and query-time. For example, to save ingest work,embodiments can select a more inexpensive specialized and/or compressedCNN 310, and then counteract the resultant loss in accuracy by runningthe expensive GT-CNN 324 on more objects at query time. Embodimentschoose parameters to offer a sharp improvement in one of the two costsfor a small degradation in the optimal other cost (note the degradationis not relative to using a GT-CNN for all index and query operations, asis discussed elsewhere herein, embodiments provide improvements to bothquery-time and ingest-time costs). Because the desired trade-off pointis application-dependent, embodiments can provide users with a choice ofthree or more options including: ingest-optimized, query-optimized, andbalanced (the default). Note that while the explanation is anchored onimage classification CNNs, the architecture of embodiments is generallyapplicable to all existing CNNs (e.g., face recognition or other CNNs).Techniques that are used for CNN compression and specialization, andfeature extraction from the CNNs are all broadly applicable to all CNNs.

Video Ingest & Querying Techniques

In this section, techniques used in embodiments, such as usinginexpensive CNN models at ingest-time, identifying similar objects andframes to save on redundant CNN processing, specializing the CNNs to thespecific videos that are being analyzed, and setting parameters aredescribed.

Inexpensive Ingestion

Embodiments can index the live videos at ingest-time to reduce thequery-time latency. Object detection can be performed on each frame,typically an inexpensive operation in terms of compute cost. Thenextracted objects can classified using ingest-time CNNs 310 that aremore inexpensive than the ground-truth GT-CNN 324. These classificationscan be used to index objects by class.

Inexpensive Ingest-Time CNN

As noted earlier, a user can provide embodiments with the GT-CNN 324.Optionally, the user can provide another classifier architecture to beused for the inexpensive CNN 310, such as AlexNet and Visual GeometryGroup (VGG), which vary in their resource costs, application, andaccuracies. Starting from these user-provided CNNs, embodiments canapply various levels of compression, such as removing convolutionallayers and/or reducing the input image resolution. This results in a setof CNN options for ingestion, {Inexpensive CNN₁; . . . ; inexpensiveCNN_(n)}, with a range of costs and accuracies.

Top-k Ingest Index

To keep recall high, embodiments index each object using the top-kobject classes from Inexpensive CNN_(i)'s output, instead of using justthe top-most class as in typical CNN output. Recall, that the output ofthe CNN is a list of object classes in descending order of confidence.Empirical evidence suggests that the top-most output of the expensiveGT-CNN 324 is often in the top-k classes 316 output by the inexpensiveCNN 310 (even for a small value of k relative to the 1,000 classesrecognized by the CNNs).

FIG. 4 illustrates, by way of example, a bar graph 400 detailing aneffect of k on recall on one of the video streams. The three models inthe figure are ResNet18, ResNet18 with 3 layers removed, and ResNet18with 5 layers removed. Additionally, the input images were resealed to224, 112, and 56 pixels, respectively. All models were retrained ontheir original training data (ImageNet). There is an increase in recallwith increasing k, for all three Inexpensive CNNs. FIG. 4 illustratesthat Cheap CNN1, Cheap CNN2, and Cheap CNN3 reach 90% recall when k=60,k=100, and k=200, respectively. Note that all these models recognize1000 classes, so even k=200 represents only 20% of the possible classes.Second, there is a trade-off between different models—the moreinexpensive they are, the lower their recall with the same k. Overall,by selecting the appropriate k, embodiments can achieve a target recall.

Embodiments can create the top-k index 318 of an object's top-k classesoutput by a Cheap CNN_(i) at ingest-time. While filtering for objects ofthe queried class X, using the top-k index (with the appropriate k) willhave a high recall, but it will have very low precision. Since eachobject is associated with k classes (while it has only one true class),the average precision can be only 1/k. Thus, at query time, to keep theprecision high, embodiments determine the actual class of objects fromthe top-k index using the expensive GT-CNN 324 and only return objectsthat match the queried class.

The selection of the inexpensive ingest-time CNN 310 model (CheapCNN_(i)) and the k value (for the top-k results) have an influence onthe recall of the outputs produced. Lower values of k reduce recall(e.g., embodiments will miss returning frames that contain the queriedobjects). At the same time, higher values of k increase the number ofobjects to classify with the GT-CNN 324 at query time to keep precisionhigh, and hence adds to the latency. An explanation of how embodimentscan set these parameters to be jointly set with other parameters isprovided elsewhere herein.

Redundancy Elimination

At query time, embodiments can retrieve the objects likely matching theuser-specified class from the top-k index 318 and infer their actualclass using the GT-CNN 324. This can help ensure precision of 100%, butcan cause significant latency at query-time. Even if this inference isparallelized across many GPUs, it can still incur a large cost.Embodiments can exploit feature vector clustering to reduce this cost.If two objects are visually similar, their feature vectors can beclosely aligned (e.g., their feature vectors will be close according toa distance metric) and the associated objects will likely be classifiedas the same class (e.g., “cars”) by the GT-CNN 324.

Embodiments can cluster objects that are similar, invoke the expensiveGT-CNN 324 only on the image data for the cluster centroids 322, andassigns the centroid's label (as determined by the GT-CNN 324) to allobjects in each cluster. Doing so reduces the work done by the GT-CNN324 classifier at query-time. Embodiments can use the feature vector 312output by the previous-to-last layer of the inexpensive ingest CNN 310for determining the object clusters 314. Note that embodiments cancluster the objects in the frames 304 and not the frames 304 as a whole.

Given the high volume of video data, a single-pass technique can helpkeep the overhead lower, as the complexities of most clusteringtechniques are quadratic. The technique can make no assumptions on thenumber of clusters and can adapt to outliers in data points on the fly.

To satisfy these constraints, the following simple approach forincremental clustering can be used. Put the first object into a firstcluster c₁. To cluster a new object i with a feature vector f₁, assignit to the closest cluster c_(j) if c_(j) is at most distance T away fromf_(i). However, if none of the clusters are within a distance T, createa new cluster with centroid at f_(i), where T is a distance threshold.The distance can be measured as the L2 norm, L1 norm, or other normbetween a feature vector of the cluster centroid and object featurevector. The number of clusters can be kept at a constant, M, by removingthe smallest clusters and storing their data in the top-k index 318.Using this technique, the popular clusters (such as similar cars) cangrow, while keeping the complexity as O(M_(n)), which is linear to n,the total number of objects.

Clustering can reduce both precision and recall, depending on parameterT. If the centroid object 322 is classified by the GT-CNN 324 as thequeried class X but the object cluster 314 contains another object of adifferent class, it reduces precision. If the centroid object 322 isclassified as a class different than X but the object cluster 314 has anobject of class X, it reduces recall. A discussion regarding setting Tis provided elsewhere herein.

Clustering at Ingest vs. Query Time

Embodiments can cluster the objects 306 at ingest-time rather than atquery-time. Clustering at query-time can involve storing all featurevectors, loading them for objects filtered from the ingest index, andthen clustering them. Instead, clustering at ingest-time createsclusters around the time the feature vectors 312 are created and onlystores the cluster centroid objects 322 in the top-K index 318. Thismakes the query-time latency lower and reduces the size of the top-kindex 318. The ordering of indexing and clustering operations is mostlycommutative in practice and has minor impact on result accuracy.Embodiments can use ingest-time clustering due to its latency andstorage benefits.

Pixel Differencing of Objects

Clustering primarily reduces work done at query-time e.g., reduces anumber of objects to be classified by the GT-CNN 324). Embodiments canalso employ pixel differencing among objects in adjacent incomingframes, such as to reduce ingest cost. If two objects have similar pixelvalues, embodiments only can run the inexpensive CNN 310 on one of themand assign them both to the same object cluster 314 in the top-K index318.

Video-Specific Specialization of CNNs

Embodiments can use an inexpensive ingest-time CNN 310, Cheap CNN_(i) toindex object classes. Embodiments can further reduce cost byspecializing the ingest-time CNN 310 to each video stream. Modelspecialization benefits from at least two properties of objects in eachvideo stream. First, while object classification CNNs are trained todifferentiate between thousands of object classes, many video streamscontain only a small number of classes. Second, objects in a specificstream are often visually more constrained than objects in general(e.g., as compared to the ImageNet dataset). The cars and buses thatoccur in a specific traffic camera have much less variability (e.g.,they have very similar angle, distortion and size, than a generic set ofvehicles).

Instead of training the CNN 310 to differentiate among thousands ofobject classes, the CNN 310 can be trained to differentiate among just asubset of the classes that the GT-CNN 324 can identify. This is a muchsimpler task than training each of the CNNs 310 to recognize all imageclasses. Training the CNN 310 in this manner can include using simplerimage features and/or smaller image resolutions. As a result, thespecialized CNNs 310 are smaller and more accurate. For example, byretraining a stream-specific Cheap CNN_(i) to only recognize objectsthat occur frequently in a video stream, similar accuracy can beachieved on video streams, while removing ⅓ of the convolutional layersand making the input image 4 times smaller in resolution. This leads tothe specialized Cheap CNN_(i) being 10 times more inexpensive than eventhe generic Cheap CNN_(i).

Since the specialized CNN classifies across fewer classes, theclassification is more accurate, which allows embodiments to select asmaller k (for the top-k ingest index 318) to meet the desired recall.Specialized CNNs can use k=2 or 4, much smaller than a typical k=60 toabout 200 for the generic inexpensive CNNs. Smaller k directlytranslates to fewer objects that are classified by GT-CNN 324 at querytime, thus reducing latency.

Model Retraining

On each video stream, embodiments can periodically obtain some videoframes and classify their objects using the GT-CNN 324 to estimate theground truth distribution of the object classes for the video. From thisdistribution, embodiments can select the most frequently occurringobject classes and retrain new specialized CNNs 310. There is usually a“power law” in the distribution of classes—a small subset of classesaccount for a dominant majority of the objects 306 in a videostream—thus, small numbers of object classes usually suffice.

Specialization can also be based off a family of CNN architectures(e.g., ResNet, AlexNet, or VGG) with different numbers of convolutionlayers. Specialization adds to the set of options available for ingestCNNs ({Cheap CNN₁; . . . ; Cheap CNN_(n)}. Embodiments can pick the bestmodel (Cheap CNN_(i)) and the corresponding k for the index.

An “OTHER” Class

While embodiments can specialize the CNN 310 towards the most frequentlyoccurring classes, support for querying the less frequent classes can beprovided. For this purpose, embodiments can include an additional classcalled “OTHER” in the specialized model. Being classified as OTHERsimply means not being one of the most frequently occurring classes.

At query time, if the queried class is among the OTHER classes of theingest CNN's index 318, embodiments can extract all the object clusters314 that match the OTHER class and classify their centroids through theGT-CNN 324. The parameter for the number of clusters (for each stream)exposes a trade-off. Using a small number of clusters allows training ona simpler model with more inexpensive ingest cost and lower query-timelatency for the popular classes, however, it also leads to a largerfraction of objects falling in the OTHER class. Querying objects in theOTHER class can be expensive because all those objects will have to beclassified by the GT-CNN 324. Using a larger number of clusters, on theother hand, leads to a more expensive ingest CNN 310 and query-timemodels, but more inexpensive querying for the OTHER classes.

Balancing Accuracy, Latency, and Cost

Embodiments' accuracy, ingest cost, and query latency can be impacted bythe parameters: k, the number of top results from the ingest-time CNN310 to index an object 306; L_(s), the number of popular object classesused to create the specialized CNN 310, Cheap CNN_(i), the specializedinexpensive CNN 310, and T, the distance threshold for clusteringobjects. The effect of these four parameters is intertwined. All thefour parameters impact ingest cost, query latency, and recall, but onlyT impacts precision. This is, at least in part, because the clustercentroids classification by the GT-CNN 324 is applied to all the objectsin its cluster 314. Thus, if the clustering is not tight (e.g., highvalue of T), precision is lost.

Parameter Selection

Embodiments can select parameter values per video stream. Embodimentscan sample a representative fraction of frames of the video stream andclassify them using GT-CNN for the ground truth. For each combination ofparameter values, embodiments can compute the expected precision andrecall (using the ground truths generated by GT-CNN 324) that would beachieved for each of the object classes.

To navigate the combinatorial space of options, a two-step approach canbe employed. In the first step, embodiments can choose the CheapCNN_(i), Ls, and k, using only the recall target. In the next step,embodiments can iterate through the values of T, the clustering distancethreshold, and only select a value for T that meets the precisiontarget.

Trading off Ingest Cost and Query Latency

Among the combination of values that meet the precision and recalltargets, the selection can be based on balancing the ingest-time andquery-time costs. For example, picking a Cheap CNN_(i) that is moreaccurate will have higher ingest cost, but lower query cost, because alower k value, can be used. Using a less accurate Cheap CNN_(i) can havethe opposite effect. Embodiments can identify “intelligent defaults”that improve one of the two costs for a small worsening of the othercost (as compared to an optimal reduction of both query-time andingest-time costs).

FIG. 5 illustrates, by way of example, a graph of parameter selectionbased on the ingest cost and query latency for one of the video streams(auburn_c). FIG. 5 illustrates plots of all the “viable configurations”(e.g., sets of parameters that meet the precision and recall target)based on their ingest cost (e.g., cost of Cheap CNN_(i)) and querylatency (e.g., the number of clusters according to k, Ls, and T). APareto boundary can be identified, which is the set of configurationsthat cannot improve one metric without worsening the other. Embodimentscan discard all the other configurations because at least one point onthe Pareto boundary is better than the other points in both metrics.Embodiments can balance between the ingest cost and query latency byselecting the configuration that minimizes the sum of ingest and querycost (e.g., measured in total GPU cycles).

Embodiments allow for other configurations based on the application'spreferences and query rates. Opt-Ingest can minimize the ingest cost andis applicable when the application expects most of the video streams tonot get queried (such as a surveillance cameras), as this policy alsominimizes the amount of wasted ingest work. On the other hand, opt-querycan minimize query latency even if it incurs a heavy ingest cost. Suchflexibility allows embodiments to apply to different applications.

Implementation Details

Embodiments ingest-time work can be distributed across multiplemachines, with each machine running a worker process for each videostream's ingestion. The ingest worker can receive the live video streamand extract the moving objects (using background subtraction). Theembodiments can be extensible to plug in other object detectors. Thedetected objects can be sent to the ingest-time CNN 310 to infer thetop-k classes 316 and the feature vectors 312.

The ingest worker can use the features to form the object clusters 314in its video stream and store the top-k index 318 in a database (e.g.,MongoDB, another non-relation database or a relational database), suchas for retrieval at query-time. Worker processes can serve queries byfetching the relevant frames off the top-lam index 318 and classifyingthe objects with GT-CNN 324. Work to satisfy a query can be parallelizedacross many worker processes, such as if resources are idle.

GPUs for CNN Classification

The inexpensive CNNs 310 and GT-CNN 324 can execute on GPUs (or otherhardware accelerators for CNNs) which could either be local on the samemachine as the worker processes or “disaggregated” on a remote cluster.This detail can be abstracted away from the worker process andseamlessly works with both designs.

Dynamically Adjusting k at Query-Time

A new k_(x)≤k can be selected at query-time. Only clusters where class Xappears among the top-k_(x) classes can be extracted from the top-kindex 318. This can result in fewer clusters and thus also lowerquery-time latency. This technique is useful in at least twoscenarios: 1) some classes might be very accurately classified by theinexpensive CNN 310 and using a lower k_(x) will still meet theuser-specified accuracy, yet will result in lower latency at query-time;2) if it is desired to retrieve only some objects of class X, a lowerk_(x) can be used to quickly retrieve some of the objects in the class.If more objects are required, k_(x) can be increased to return moreframes with relevant objects,

Evaluation

Some embodiments were evaluated with more than 150 hours of videos from13 real video streams that span across traffic cameras, surveillancecameras, and news channels. FIG. 6 illustrates by way of example, a bargraph of a general summary of evaluation results. Highlights of resultsinclude: (1) On average, embodiments are simultaneously 58 times (up to98 times) more inexpensive than the ingest-all baseline in its GPUconsumption and 37 times (up to 57 times) faster than the query-allbaseline in query latency, all the while achieving at least 95%precision and recall. (2) Embodiments provide a rich trade-off spacebetween ingest cost and query latency. Among the video streams, theingest cost is up to 141 times more inexpensive than the ingest-allbaseline (and reduces query latency by 46 times) if optimizing forlow-cost ingest. The query latency is reduced by up to 66 times (with 11times more inexpensive ingest) if optimizing for query latency. (3)Embodiments are effective under broad conditions such as high accuracytargets and various frame sampling rates.

Setup

OpenCV 3.2.0 was used to decode the videos into frames, and then use thebuilt-in background subtraction technique in OpenCV to extract movingobjects from video frames. Background subtraction was used instead ofobject detector CNNs (e.g., YOLOv2 or Faster R-CNN) to detect objectsbecause: (1) running background subtraction is orders of magnitudefaster than running these CNNs, and (2) background subtraction candetect moving objects more reliably. CNNs were run and trained withMicrosoft Cognitive Toolkit 2.1, an open-source deep learning system.

Video Datasets

13 live video streams were evaluated that span across traffic cameras,surveillance cameras, and news channels. 12 hours of each video streamwere evaluated each video stream, which evenly cover day time and nighttime. Table 1 summarizes the video characteristics.

TABLE 1 TYPE NAME LOCATION DESCRIPTION TRAFFIC AUBURN_C AL, USACommercial area inter- section TRAFFIC AUBURN_R AL, USA Residential areainter- section TRAFFIC CITY_A_D USA Downtown intersection TRAFFICCITY_A_R USA Residential area inter- section TRAFFIC BEND OR, USARoad-side camera TRAFFIC JACKSON WY, USA Busy intersection HOLE SURVEIL-CHURCH_ST VT, USA Video stream rotates LANCE among cameras in a (SURV)shopping mall SURV LAUSANNE SWITZERLAND Pedestrian plaza SURV OXFORDENGLAND Bookshop street SURV SITTARD NETHERLANDS Market square NEWS CNNUSA News channel NEWS FOXNEWS USA News channel NEWS MSNBC USA Newschannel

By default, each video was evaluated at 30 frames per second andsensitivity was evaluated to other frame rates. In some FIGS. only arepresentative sample of 9 cameras are shown, such as to not obscure theview in the FIGS.

Accuracy Target

ResNet152, a state-of-the-art CNN, was used as the ground-truth CNN(GT-CNN 324). All extracted objects were evaluated with the GT-CNN 324and the results were used as the correct answers. A class is defined aspresent in a one-second segment of video if the GT-CNN 324 reports suchclass in 50% of the frames in that segment. This criterion was used asthe ground truth because the GT-CNN 324 sometimes gives differentresults to the exact same object in consecutive frames, and thiscriterion can effectively eliminate these random, erroneous results. Inembodiments, the default accuracy target as 95% recall and 95% precisionis set. The results are analyzed with other accuracy targets such as97%, 98%, and 99%. Note that in most practical cases, only one of thetwo metrics (recall or accuracy is high. For example, an investigatorcares about high recall, and looking through some irrelevant results isan acceptable trade-off. By setting both targets high, the performanceis set to a lower bound that embodiments can achieve.

Baselines and Metrics

Two baselines are used for comparisons: (1) Ingest-all, the baselinesystem that uses GTCNN 324 to analyze all objects at ingest time, andstores the inverted index for query; and (2) Query-all, the baselinesystem that simply extracts objects at ingest time, and uses the GT-CNN324 to analyze all the objects that fall into the query interval atquery time. Note both baselines are augmented with basic motiondetection (background subtraction), and they do not run any GT-CNN 324on the frames that have no moving objects.

Two performance metrics are used. The first metric is ingest cost, whichis the GPU time to ingest each video. The second metric is querylatency, which is the latency for an object class query. Specifically,for each video stream, all dominant object classes are evaluated and theaverage of their latencies is taken. Querying for non-dominant “OTHER”classes is much more inexpensive than querying popular classes, andwould skew the results because there are far more such classes thus,focus in this discussion is on the more prevalent classes). Both metricsinclude only GPU time spent classifying images and excludes other (CPU)time spent decoding video frames, detecting moving objects, recordingand loading video, and reading and writing to the top-k index. Focus issolely on GPU time because when the GPU is involved, it is thebottleneck resource. The query latency of ingest-all is 0 and the ingestcost of query-all is 0.

Experiment Platform

The experiments were run on a local cluster. Each machine in the clusterwas equipped with a graphics processing unit (GPU) (NVIDIA Titan X),16-core Intel Xeon central processing unit (CPU) (E5-2698), 64 GB randomaccess memory (RAM), a 40 Gb Ethernet network interface card (NIC), andoperated on a 64-bit Ubuntu 16.04 long term support (LTS).

End-to-End Performance

The end-to-end performance of embodiments is shown by showing ingestcost and query latency when embodiments can balance these two metrics.FIG. 6 illustrates, by way of example, graphs of a comparison of theingest cost of embodiments with ingest-all and the query latency ofembodiments with query-all. Embodiments improve query latency with avery small ingest cost. Embodiments makes queries by an average of 37times faster than query-all with a small cost at ingest time (an averageof 58 times more inexpensive than ingest-all). With a 10-GPU cluster,the query-latency on a 24-hour video goes down from one hour to lessthan two minutes. The processing cost of each video stream goes downfrom $250/month to $4/month. This shows that embodiments can strike abalance between these two competing goals.

Further, embodiments are effective across different video streams withvarious characteristics. Embodiments make queries 11 times to 57 timesfaster with a very small ingest time cost (48 times to 98 times moreinexpensive) across busy intersections (auburn_c, city_a_d andjacksonh), normal intersections or roads (auburn_r and city_a_r, bend),rotating cameras (church_st), busy plazas (lausanne and sittard), auniversity street (oxford), and different news channels (cnn, foxnews,and msnbc). Among these videos, the gains in query latency are smallerfor relatively less busy videos (auburn_r, bend, lausanne, and oxford).This is because these videos are dominated by fewer object classes, andembodiments have more work (e.g., analysis using the GT-CNN 324) to doat query-time for these classes. According to the results, the coretechniques are general and effective on a variety of real-world videos.

Effect of Different Focus Components

FIGS. 7a and 7b illustrate, by way of example, the breakdown ofingest-time cost and query latency across different design points: (1)Compressed model, which applies a generic compressed model for indexingat ingest time, (2) Compressed+Specialized model, which uses aper-stream specialized and compressed model for indexing, and (3)Compressed+Specialized model+Clustering, which adds feature-basedclustering at ingest time to reduce redundant work at query time. Allthe above include the top-k index 318 and using GT-CNN 324 atquery-time, and achieve the same accuracy of 95%.

First, generic compressed models provide benefits for both ingest costand query latency, but they are not the major source of improvement.This is at least in part because the accuracy of a generic compressedmodel degrades significantly when convolutional layers are removed. Toretain the accuracy target, relatively expensive compressed models(Cheap CNN_(i)) and a larger k, which incur higher ingest cost and querylatency, can be used. Second, specializing the CNN (in addition tocompressing the CNN) reduces ingest cost and query latency. Because offewer convolutional layers and smaller input resolution, the specializedCNNs are 7 times to 71 times more inexpensive than the GT-CNN 324, whileretaining the accuracy target for each video stream. Running aspecialized model at ingest time speeds up query latency by 5 times to25 times (FIG. 7b ).

Third, clustering is an effective technique to further reduce querylatency with unnoticeable costs at ingest time. As FIG. 7b shows, usingclustering (on top of a specialized and compressed CNN) reduces thequery latency by up to 56 times. This is significantly better than justrunning a specialized and compressed CNN at ingest time. This gain comeswith a negligible cost (FIG. 7a ), because the clustering technique isrun on the CPUs of the ingest machine, which is fully pipelined with theGPUs that run the specialized CNN.

Ingest Cost vs. Query Latency Trade-off

Embodiments can provide flexibility to tune its system parameters toachieve different application goals. Three alternative settings forembodiments illustrate the trade-off space between ingest cost and querylatency: (1) Opt-query, which optimizes for query latency by increasingingest cost. (2) Balance, which is the default option that balances thetwo metrics, and (3) Opt-ingest, which is the opposite of opt-query.Embodiments offer options in the trade-off space between ingest cost andquery latency. Opt-ingest achieves 141 times more inexpensive cost thaningest-all to ingest the video stream, and makes the query 46 timesfaster than doing nothing at ingest (query-all). Opt-query reduces querylatency by 63 times with a relatively higher ingest cost, but it isstill 26 times more inexpensive than ingest-all. As they are all goodoptions compared to the baselines, such flexibility allows a user totailor embodiments for different contexts. For example, a traffic camerathat requires fast turnaround time for queries can use opt-query, whilea surveillance video stream that will be queried very rarely can useopt-ingest to reduce the amount of wasted ingest cost.

FIG. 8 illustrates, by way of example, a graph that illustrates the (I,Q) values for both opt-ingest (Opt-I) and opt-query (Opt-Q) for therepresentative videos. As can be seen in FIG. 8, the trade-offflexibility exists among all the videos. On average, opt-ingest has only95 times more inexpensive ingest cost to provide 35 times query latencyreduction. On the other hand, opt-query makes queries 49 times fasterwith a higher ingest cost (15 times more inexpensive than ingest-all).Embodiments provide flexibility between ingest cost and query latency,and make it a better fit in different contexts.

Sensitivity to Accuracy Target

FIGS. 9 and 10 illustrate, by way of example, bar graphs of theimprovements of ingest cost and query latency of embodiments compared tothe baselines under different accuracy targets. Other than the default95% accuracy target (recall and precision), three higher targets, 97%,98%, and 99% are also evaluated. As FIGS. 9 and 10 show, with higheraccuracy targets, the ingest costs are about the same, and theimprovement of query latency decreases. Embodiments keep the ingest costsimilar (62 times to 64 times more inexpensive than the baseline)because it still runs the specialized and compressed. CNN 310 at ingesttime. However, when the accuracy targets are higher, embodiments selectmore top-k classification results, which increases the work at querytime. On average, the query latency of embodiments is faster thanquery-all by 15 times, 12 times, and 8 times with 97%, 98%, and 99%accuracy targets, respectively. The techniques of embodiments canachieve higher accuracy targets with significant improvements on bothingest cost and query latency.

Sensitivity to Frame Sampling

A common approach to reduce the video processing time is to use framesampling (e.g., periodically select a frame to process). However, notall applications can use frame sampling because it can miss objects thatshow up and disappear within a frame sampling window. As the framesampling rate is an application dependent choice, the sensitivity ofperformance of embodiments is provided for different frame rates.

FIGS. 11 and 12, illustrate, by way of example the ingest cost and querylatency of embodiments at different frame rates (e.g., 30 fps, 10 fps, 5fps, and 1 fps) compared to ingest-all and query-all, respectively.First, the ingest cost reduction is roughly the same across thedifferent frame rates. On average, the ingest cost of embodiments is 62times more inexpensive than ingest-all at 30 fps, and is 58 times to 64times more inexpensive at lower frame rates. This is because the majoringest cost saving comes from the specialized and compressed CNN 310,which are orthogonal to frame sampling rates.

Second, the query latency improvement of embodiments degrades with lowerframe rates. This can be expected because one technique to reduce querylatency is redundancy elimination, especially clustering similar objectsusing CNN feature vectors 312. At lower frame rates, the benefit of thistechnique reduces because there are fewer redundancies. Nonetheless, onaverage, embodiments are still one order of magnitude faster thanquery-all at a very low frame rate (1 fps).

Applicability with Different Query Rate

There are at least two factors that can affect the applicability ofembodiments: 1) the number of classes that get queried over time and 2)the fraction of videos that get queried. In the first extreme case whereall the classes and all the videos are queried, ingest-all can be a goodoption because its cost is amortized among all the queries. Even in suchan extreme case, the overall cost of embodiments is still 4 times moreinexpensive than ingest-all on average (up to 6 times more inexpensive)because the inexpensive CNN 310 is run at ingest time, and the GT-CNN324 is run per object cluster only once, so the overall cost is stillmore inexpensive than ingest-all.

The second extreme case is when only a tiny fraction of videos getsqueried. While embodiments can save the ingest cost by up to 141 times,it can be more costly than query-all if the fraction of videos getsqueried is less than 1/141=0.7%. In such a case, nothing can be done atingest time and all the techniques of embodiments can be run only atquery time when the fraction of videos that get queried is known. Whilethis approach increases query latency, it still reduces the querylatency by an average of 22 times (up to 34 times) than query-all.Embodiments are still better than both baselines even under extremequery rates.

Answering queries of the form, “find me frames that contain objects ofclass X” is an important workload on recorded video datasets. Suchqueries are used by analysts and investigators, and it can be importantto answer these queries with low latency and low cost. Embodimentsherein include a system that performs low cost ingest-time analytics onlive video that later facilitates low-latency queries on the recordedvideos. Embodiments can use compressed and specialized CNNs atingest-time that reduces cost. Embodiments cluster similar objects toreduce the work done at query-time, and hence the latency. Embodimentscan select the ingest-time CNN and its parameters to trade-off betweenthe ingest-time cost and query-time latency. Evaluations using 150 hoursof video from traffic, surveillance, and news domains show thatembodiments can reduce GPU consumption by 58 times and makes queries 37times faster compared to current baselines. Embodiments provide anapproach to querying large video datasets. Embodiments can includetraining a specialized and highly accurate query-time CNN for eachstream and object to further reduce query latency.

FIG. 13 illustrates, by way of example, a diagram of an embodiment of amethod 1300 for video ingest, index, and/or query fulfillment. Themethod 1300 includes classifying (using a compressed and specializedconvolutional neural network (CNN)), an object of a video frame intoclasses, at operation 1310; clustering the object based on a distance ofa feature vector of the object to a feature vector of a centroid objectof the cluster, at operation 1320; storing (for each object) image data,top-k classes of the classes, a centroid identification (indicating acentroid of the cluster), and a cluster identification (indicating thecluster associated with the centroid), at operation 1330; and for eachcentroid determined to be classified as a member of a class X by aground truth CNN (GT-CNN), providing image data for each object in eachcluster associated with the centroid.

The method 1300 can further include in response to receiving a query forobjects of class X from a specific video stream, retrieving image datafor each centroid of each cluster that includes the class X as a memberof the stored top-k classes. The method 1300 can further includeclassifying, using the GT-CNN, the retrieved image data for eachcentroid. The method 1300 can further include, wherein the compressedand specialized CNN is one of a plurality of compressed and specializedCNNs, and receiving data indicating a target recall and a targetprecision, and selecting the compressed and specialized CNN of thecompressed and specialized CNNs and k that meet the received targetrecall and target precision.

The method 1300 can further include, wherein the specialized andcompressed CNN includes the GT-CNN with one or more convolutional layersremoved and trained to classify only a subset of the classes for whichthe GT-CNN has been trained. The method 1300 can further includeclassifying only one instance of image data of an object determined tobe present in multiple video frames. The method 1300 can further includedetermining which classes of objects of a video stream appear in morethan a threshold percentage of the video frames of the video stream, andwherein the subset of the classes includes the determined classes and another class, wherein all objects determined to not be sufficiently closeto a centroid object are associated with the other class.

The method 1300 can further include, wherein each object in each clusteris associated with top-k classes for which the object may be a member,and wherein the centroid for each cluster is associated with the top-kclasses that occur most frequently in the top-k classes of the objectsof the associated cluster. The method 1300 can further include reducingimage resolution of the image data before classifying the image data.

FIG. 14 illustrates, by way of example, a block diagram of an embodimentof a machine 1400 (e.g., a computer system) to implement one or moreembodiments. One example machine 1400 (in the form of a computer), mayinclude a processing unit 1002, memory 1003, removable storage 1010, andnon-removable storage 1012. Although the example computing device isillustrated and described as machine 1400, the computing device may bein different forms in different embodiments. For example, the computingdevice may instead be a smartphone, a tablet, smartwatch, or othercomputing device including the same or similar elements as illustratedand described with regard to FIG. 14. Devices such as smartphones,tablets, and smartwatches are generally collectively referred to asmobile devices. Further, although the various data storage elements areillustrated as part of the machine 1400, the storage may also oralternatively include cloud-based storage accessible via a network, suchas the Internet.

Memory 1003 may include volatile memory 1014 and non-volatile memory1008. The machine 1400 may include—or have access to a computingenvironment that includes a variety of computer-readable media, such asvolatile memory 1014 and non-volatile memory 1008, removable storage1010 and non-removable storage 1012. Computer storage includes randomaccess memory (RAM), read only memory (ROM), erasable programmableread-only memory (EPROM) & electrically erasable programmable read-onlymemory (EEPROM), flash memory or other memory technologies, compact discread-only memory (CD ROM), Digital Versatile Disks (DVD) or otheroptical disk storage, magnetic cassettes, magnetic tape, magnetic diskstorage or other magnetic storage devices capable of storingcomputer-readable instructions for execution to perform functionsdescribed herein.

The machine 1400 may include or have access to a computing environmentthat includes input 1006, output 1004, and a communication connection1016. Output 1004 may include a display device, such as a touchscreen,that also may serve as an input device. The input 1006 may include oneor more of a touchscreen, touchpad, mouse, keyboard, camera, one or moredevice-specific buttons, one or more sensors integrated within orcoupled via wired or wireless data connections to the machine 1400, andother input devices. The computer may operate in a networked environmentusing a communication connection to connect to one or more remotecomputers, such as database servers, including cloud based servers andstorage. The remote computer may include a personal computer (PC),server, router, network PC, a peer device or other common network node,or the like. The communication connection may include a Local AreaNetwork (LAN), a Wide Area Network (WAN), cellular, Institute ofElectrical and Electronics Engineers (IEEE) 802.11 (Wi-Fi), Bluetooth,or other networks.

Computer-readable instructions stored on a computer-readable storagedevice are executable by the processing unit 1002 of the machine 1400. Ahard drive, CD-ROM, and RAM are some examples of articles including anon-transitory computer-readable medium such as a storage device. Forexample, a computer program 1018 may be used to cause processing unit1002 to perform one or more methods or algorithms described herein.

ADDITIONAL NOTES AND EXAMPLES

Example 1 includes at least one machine-readable storage mediumincluding instructions for execution by processing circuitry to performoperations comprising classifying, using a compressed and specializedconvolutional neural network (CNN) implemented by the processingcircuitry, an object of a video frame into classes, clustering theobject based on a distance of a feature vector of the object to afeature vector of a centroid object of the cluster, storing, for eachobject, image data, top-k classes of the classes, a centroididentification indicating a centroid of the cluster, and a clusteridentification indicating the cluster associated with the centroid, andfor each centroid determined to be classified as a member of the classX, by a ground truth CNN (GT-CNN) implemented by the processingcircuitry, providing image data for each object in each clusterassociated with the centroid.

In Example 2, Example 1 may further include, wherein the operationsfurther comprise in response to receiving a query for objects of class Xfrom a specific video stream, retrieving image data for each centroid ofeach cluster that includes the class X as a member of the stored top-kclasses, and classifying, using the GT-CNN, the retrieved image data foreach centroid.

In Example 3, at least one of Examples 1-2 may further include, whereinthe compressed and specialized CNN is one of a plurality of compressedand specialized CNNs, and wherein the operations further comprisereceiving data indicating a target recall and a target precision, andselecting the compressed and specialized CNN of the compressed andspecialized CNNs and k that meet the received target recall and targetprecision.

In Example 4, at least one of Examples 1-3 may further include, whereinthe specialized and compressed CNN includes the GT-CNN with one or moreconvolutional layers removed and trained to classify only a subset ofthe classes for which the GT-CNN has been trained.

In Example 5, at least one of Examples 1-4 may further include, whereinthe operations further comprise, classifying only one instance of imagedata of an object determined to be present in multiple video frames.

In Example 6, Example 4 may further include, wherein the operationsfurther comprise determining which classes of objects of a video streamappear in more than a threshold percentage of the video frames of thevideo stream, and wherein the subset of the classes includes thedetermined classes and an other class, wherein all objects determined tonot be sufficiently close to a centroid object are associated with theother class.

In Example 7, at least one of Examples 1-6 may further include, whereineach object in each cluster is associated with top-k classes for whichthe object may be a member, and wherein the centroid for each cluster isassociated with the top-k classes that occur most frequently in thetop-k classes of the objects of the associated cluster.

In Example 8, at least one of Examples 1-7 may further include, whereinthe operations further comprise reducing image resolution of the imagedata before classifying the image data.

Example 9 includes a method, performed by at least one processor of acomputing system, the method comprising classifying, using a compressedand specialized convolutional neural network (CNN), an object of a videoframe into classes, clustering the object based on a distance of afeature vector of the object to a feature vector of a centroid object ofthe cluster, storing, for each object, image data, top-k classes of theclasses, a centroid identification indicating a centroid of the cluster,and a cluster identification indicating the cluster associated with thecentroid, in response to receiving a query for objects of class X from aspecific video stream, retrieving image data for each centroid of eachcluster that includes the class X as a member of the stored top-kclasses, classifying, using a ground truth CNN (GT-CNN), the retrievedimage data for each centroid, and for each centroid determined to beclassified as a member of the class X, by the GT-CNN, providing imagedata for each object in each cluster associated with the centroid.

In Example 10, Example 9 may further include, wherein the compressed andspecialized CNN is one of a plurality of compressed and specializedCNNs, and the method further comprises receiving data indicating atarget recall and a target precision, and choosing the compressed andspecialized CNN of the compressed and specialized CNNs and k to meet thereceived target recall and target precision.

In Example 11, at least one of Examples 9-10 may further include,wherein the specialized and compressed CNN includes the GT-CNN with oneor more convolutional layers removed and trained to classify only asubset of the classes for which the GT-CNN has been trained.

In Example 12, at least one of Examples 9-11 may further include,classifying only one instance of image data of an object determined tobe present in multiple video frames.

In Example 13, Example 11 may further include determining which classesof objects of a video stream appear in more than a threshold percentageof the video frames of the video stream, and wherein the subset of theclasses includes the determined classes and an other class, wherein allobjects determined to not be sufficiently close to a centroid object areassociated with the other class.

In Example 14, at least one of Examples 9-13 may further include,wherein each object in each cluster is associated with top-k classes forwhich the object may be a member, and wherein the centroid for eachcluster is associated with the top-k classes that occur most frequentlyin the top-k classes of the objects of the associated cluster.

In Example 15, at least one of Examples 9-14 may further includereducing image resolution of the image data before classifying the imagedata.

Example 16 includes a system comprising circuitry to implement aplurality of compressed and specialized convolutional neural networks(CNNs) trained to classify an object of a video frame into classes and aground truth CNN (GT-CNN) trained to classify image data of a centroidof a cluster of clusters of objects, a processor, and a memory devicecoupled to the processor, the memory device including a program storedthereon for execution by the processor to perform operations, theoperations comprising clustering the object based on a distance of afeature vector of the object to a feature vector of a centroid object ofthe cluster, storing, in the memory and for each object, a frameidentification indicating one or more frames in which the object ispresent, top-k classes of the classes, a centroid identificationindicating a centroid of the cluster, and a cluster identificationindicating the cluster associated with the centroid, and for eachcentroid determined to be classified as a member of a class X of theclasses, by the ground truth CNN (GT-CNN), providing the one or moreframes associated with the frame identification for each object in eachcluster associated with the centroid.

In Example 17, Example 16 may further include, wherein the operationsfurther comprise in response to receiving a query for objects of class Xfrom a specific video stream, retrieving image data for each centroid ofeach cluster that includes the class X as a member of the stored top-kclasses, and using the GT-CNN, classifying the retrieved image data foreach centroid.

In Example 18, at least one of Examples 16-17 may further include,wherein the operations further comprise receiving data indicating atarget recall and a target precision, and choosing the compressed andspecialized CNN of the compressed and specialized CNNs and k to meet thereceived target recall and target precision.

In Example 19, at least one of Examples 16-18 may further include,wherein a specialized and compressed CNN of the specialized andcompressed. CNNs includes the GT-CNN with one or more convolutionallayers removed and trained to classify only a subset of the classes forwhich the GT-CNN has been trained to classify.

In Example 20, at least one of Examples 16-19 may further include,wherein a compressed and specialized CNN of the compressed andspecialized CNNs is to classify only one instance of image data of anobject determined to be present in multiple video frames.

In Example 21, Example 19 may further include, wherein the operationsfurther comprise determining which classes of objects of a video streamappear in more than a threshold percentage of the video frames of thevideo stream, and wherein the subset of the classes includes thedetermined classes and an other class, wherein all objects determined tonot be sufficiently close to a centroid object are associated with theother class.

In Example 22, at least one of Examples 16-21 may further include,wherein each object in each cluster is associated with top-k classes towhich the object may be a member, and wherein the centroid for eachcluster is associated with the top-k classes that occur most frequentlyin the top-k classes of the objects of the associated cluster.

In Example 23, at least one of Examples 16-22 may further includereducing image resolution of the image data before classifying the imagedata.

Although a few embodiments have been described in detail above, othermodifications are possible. For example, the logic flows depicted in thefigures do not require the particular order shown, or sequential order,to achieve desirable results. Other steps may be provided, or steps maybe eliminated, from the described flows, and other components may beadded to, or removed from, the described systems. Other embodiments maybe within the scope of the following claims.

What is claimed is:
 1. At least one machine-readable storage mediumincluding instructions for execution by processing circuitry to performoperations comprising: classifying, using a compressed and specializedconvolutional neural network (CNN) implemented by the processingcircuitry, an object of a video frame into classes; clustering theobject based on a distance of a feature vector of the object to afeature vector of a centroid object of the cluster; storing, for eachobject, image data, top-k classes of the classes, a centroididentification indicating a centroid of the cluster, and a clusteridentification indicating the cluster associated with the centroid; andfor each centroid determined to be classified as a member of the classX, by a ground truth CNN (GT-CNN) implemented by the processingcircuitry, providing image data for each object in each clusterassociated with the centroid, the compressed and specialized CNNincludes the GT-CNN with one or more convolutional layers removed andtrained to classify only a subset of the classes for which the GT-CNNhas been trained.
 2. The at least one machine-readable medium of claim1, wherein the operations further comprise: in response to receiving aquery for objects of class X from a specific video stream, retrievingimage data for each centroid of each cluster that includes the class Xas a member of the stored top-k classes; and classifying, using theGT-CNN, the retrieved image data for each centroid.
 3. The at least onemachine-readable medium of claim 1, wherein the compressed andspecialized CNN is one of a plurality of compressed and specializedCNNs, and wherein the operations further comprise: receiving dataindicating a target recall and a target precision; and selecting thecompressed and specialized CNN of the compressed and specialized CNNsand k that meet the received target recall and target precision.
 4. Theat least one machine-readable medium of claim 1, further comprising,determining which classes of objects of a video stream appear in morethan a threshold percentage of the video frames of the video stream, andwherein the subset of the classes includes the determined classes and another class, wherein all objects determined to not be sufficiently closeto a centroid object are associated with the other class.
 5. The atleast one machine-readable medium of claim 1, wherein the operationsfurther comprise, classifying only one instance of image data of anobject determined to be present in multiple video frames.
 6. The atleast one machine-readable medium of claim 1, wherein each object ineach cluster is associated with top-k classes for which the object maybe a member, and wherein the centroid for each cluster is associatedwith the top-k classes that occur most frequently in the top-k classesof the objects of the associated cluster.
 7. The at least onemachine-readable medium of claim 1, wherein the operations furthercomprise reducing image resolution of the image data before classifyingthe image data.
 8. A method, performed by at least one processor of acomputing system, the method comprising: classifying, using a compressedand specialized convolutional neural network (CNN), an object of a videoframe into classes; clustering the object based on a distance of afeature vector of the object to a feature vector of a centroid object ofthe cluster; storing, for each object, image data, top-k classes of theclasses, a centroid identification indicating a centroid of the cluster,and a cluster identification indicating the cluster associated with thecentroid; in response to receiving a query for objects of class X from aspecific video stream, retrieving image data for each centroid of eachcluster that includes the class X as a member of the stored top-kclasses; classifying, using a ground truth CNN (GT-CNN), the retrievedimage data for each centroid, the compressed and specialized CNNincludes the GT-CNN with one or more convolutional layers removed andtrained to classify only a subset of the classes for which the GT-CNNhas been trained; and for each centroid determined to be classified as amember of the class X, by the GT-CNN, providing image data for eachobject in each cluster associated with the centroid.
 9. The method ofclaim 8, wherein the compressed and specialized CNN is one of aplurality of compressed and specialized CNNs, and the method furthercomprises: receiving data indicating a target recall and a targetprecision; and choosing the compressed and specialized CNN of thecompressed and specialized CNNs and k to meet the received target recalland target precision.
 10. The method of claim 8, further comprising,determining which classes of objects of a video stream appear in morethan a threshold percentage of the video frames of the video stream, andwherein the subset of the classes includes the determined classes and another class, wherein all objects determined to not be sufficiently closeto a centroid object are associated with the other class.
 11. The methodof claim 8, further comprising, classifying only one instance of imagedata of an object determined to be present in multiple video frames. 12.The method of claim 8, wherein each object in each cluster is associatedwith top-k classes for which the object may be a member, and wherein thecentroid for each cluster is associated with the top-k classes thatoccur most frequently in the top-k classes of the objects of theassociated cluster.
 13. The method of claim 8, further comprisingreducing image resolution of the image data before classifying the imagedata.
 14. A system comprising: circuitry to implement a plurality ofcompressed and specialized convolutional neural networks (CNNs) trainedto classify an object of a video frame into classes and a ground truthCNN (GT-CNN) trained to classify image data of a centroid of a clusterof clusters of objects; a processor; and a memory device coupled to theprocessor, the memory device including a program stored thereon forexecution by the processor to perform operations, the operationscomprising: clustering the object based on a distance of a featurevector of the object to a feature vector of a centroid object of thecluster; storing, in the memory and for each object, a frameidentification indicating one or more frames in which the object ispresent, top-k classes of the classes, a centroid identificationindicating a centroid of the cluster, and a cluster identificationindicating the cluster associated with the centroid; and for eachcentroid determined to be classified as a member of a class X of theclasses, by the ground truth CNN (GT-CNN), providing the one or moreframes associated with the frame identification for each object in eachcluster associated with the centroid, the compressed and specialized CNNincludes the GT-CNN with one or more convolutional layers removed andtrained to classify only a subset of the classes for which the GT-CNNhas been trained.
 15. The system of claim 14, wherein the operationsfurther comprise: in response to receiving a query for objects of classX from a specific video stream, retrieving image data for each centroidof each cluster that includes the class X as a member of the storedtop-k classes; and using the GT-CNN, classifying the retrieved imagedata for each centroid.
 16. The system of claim 14, wherein theoperations further comprise: receiving data indicating a target recalland a target precision; and choosing the compressed and specialized CNNof the compressed and specialized CNNs and k to meet the received targetrecall and target precision.
 17. The system of claim 14, wherein acompressed and specialized CNN of the compressed and specialized CNNs isto classify only one instance of image data of an object determined tobe present in multiple video frames.
 18. At least one machine-readablestorage medium including instructions for execution by processingcircuitry to perform operations comprising: classifying, using acompressed and specialized convolutional neural network (CNN)implemented by the processing circuitry, an object of a video frame intoclasses; clustering the object based on a distance of a feature vectorof the object to a feature vector of a centroid object of the cluster;storing, for each object, image data, top-k classes of the classes, acentroid identification indicating a centroid of the cluster, a clusteridentification indicating the cluster associated with the centroid, and,for each centroid, the top-k classes that occur most frequently in thetop-k classes of the objects of the associated cluster; and for eachcentroid determined to be classified as a member of the class X, by aground truth CNN (GT-CNN) implemented by the processing circuitry,providing image data for each object in each cluster associated with thecentroid.
 19. The at least one machine-readable medium of claim 18,wherein the operations further comprise: in response to receiving aquery for objects of class X from a specific video stream, retrievingimage data for each centroid of each cluster that includes the class Xas a member of the stored top-k classes; and classifying, using theGT-CNN, the retrieved image data for each centroid.
 20. The at least onemachine-readable medium of claim 18, wherein the compressed andspecialized CNN is one of a plurality of compressed and specializedCNNs, and wherein the operations further comprise: receiving dataindicating a target recall and a target precision; and selecting thecompressed and specialized CNN of the compressed and specialized CNNsand k that meet the received target recall and target precision.
 21. Theat least one machine-readable medium of claim 18, wherein the compressedand specialized CNN includes the GT-CNN with one or more convolutionallayers removed and trained to classify only a subset of the classes forwhich the GT-CNN has been trained.
 22. The at least one machine-readablemedium of claim 21, further comprising, determining which classes ofobjects of a video stream appear in more than a threshold percentage ofthe video frames of the video stream, and wherein the subset of theclasses includes the determined classes and an other class, wherein allobjects determined to not be sufficiently close to a centroid object areassociated with the other class.
 23. A method, performed by at least oneprocessor of a computing system, the method comprising: classifying,using a compressed and specialized convolutional neural network (CNN),an object of a video frame into classes; clustering the object based ona distance of a feature vector of the object to a feature vector of acentroid object of the cluster; storing, for each object, image data,top-k classes of the classes, a centroid identification indicating acentroid of the cluster, a cluster identification indicating the clusterassociated with the centroid, and, for each centroid, the top-k classesthat occur most frequently in the top-k classes of the objects of theassociated cluster; in response to receiving a query for objects ofclass X from a specific video stream, retrieving image data for eachcentroid of each cluster that includes the class X as a member of thestored top-k classes; classifying, using a ground truth CNN (GT-CNN),the retrieved image data for each centroid; and for each centroiddetermined to be classified as a member of the class X, by the GT-CNN,providing image data for each object in each cluster associated with thecentroid.
 24. The method of claim 23, wherein the compressed andspecialized CNN is one of a plurality of compressed and specializedCNNs, and the method further comprises: receiving data indicating atarget recall and a target precision; and choosing the compressed andspecialized CNN of the compressed and specialized CNNs and k to meet thereceived target recall and target precision.
 25. The method of claim 23,wherein the compressed and specialized CNN includes the GT-CNN with oneor more convolutional layers removed and trained to classify only asubset of the classes for which the GT-CNN has been trained.
 26. Themethod of claim 25, further comprising, determining which classes ofobjects of a video stream appear in more than a threshold percentage ofthe video frames of the video stream, and wherein the subset of theclasses includes the determined classes and an other class, wherein allobjects determined to not be sufficiently close to a centroid object areassociated with the other class.
 27. A system comprising: circuitry toimplement a plurality of compressed and specialized convolutional neuralnetworks (CNNs) trained to classify an object of a video frame intoclasses and a ground truth CNN (GT-CNN) trained to classify image dataof a centroid of a cluster of clusters of objects; a processor; and amemory device coupled to the processor, the memory device including aprogram stored thereon for execution by the processor to performoperations, the operations comprising: clustering the object based on adistance of a feature vector of the object to a feature vector of acentroid object of the cluster; storing, in the memory and for eachobject, a frame identification indicating one or more frames in whichthe object is present, top-k classes of the classes, a centroididentification indicating a centroid of the cluster, a clusteridentification indicating the cluster associated with the centroid, and,for each centroid, the top-k classes that occur most frequently in thetop-k classes of the objects of the associated cluster; and for eachcentroid determined to be classified as a member of a class X of theclasses, by the ground truth CNN (GT-CNN), providing the one or moreframes associated with the frame identification for each object in eachcluster associated with the centroid.
 28. The system of claim 27,wherein the operations further comprise: in response to receiving aquery for objects of class X from a specific video stream, retrievingimage data for each centroid of each cluster that includes the class Xas a member of the stored top-k classes; and using the GT-CNN,classifying the retrieved image data for each centroid.
 29. The systemof claim 27, wherein the operations further comprise: receiving dataindicating a target recall and a target precision; and choosing thecompressed and specialized CNN of the compressed and specialized CNNsand k to meet the received target recall and target precision.
 30. Thesystem of claim 27, wherein a compressed and specialized CNN of thecompressed and specialized CNNs includes the GT-CNN with one or moreconvolutional layers removed and trained to classify only a subset ofthe classes for which the GT-CNN has been trained to classify.
 31. Thesystem of claim 30, wherein the operations further comprise, determiningwhich classes of objects of a video stream appear in more than athreshold percentage of the video frames of the video stream, andwherein the subset of the classes includes the determined classes and another class, wherein all objects determined to not be sufficiently closeto a centroid object are associated with the other class.